#include "tcpsocketserver.h"

TcpSocketServer::TcpSocketServer(Object *parent) : Object(parent)
{
    sockfd = 0;
    sockfd = socket(AF_INET, SOCK_STREAM, 0);

    if (sockfd >= 0)
        puts("socket");
    else
        puts("error");

    //bzero((char*) &serv_addr, sizeof(serv_addr));
    int portno = 5001;
    serv_addr.sin_family = AF_INET;
    serv_addr.sin_addr.s_addr = INADDR_ANY;
    serv_addr.sin_port = htons(portno);
    int a = bind(sockfd, (struct sockaddr*) &serv_addr, sizeof(serv_addr));
    if (a > 0)
        puts("bind");

    listen(sockfd, 3);
}

TcpSocketServer::~TcpSocketServer()
{}

//void TcpSocketServer::listen()
//{}

void TcpSocketServer::incomingConnection(int sockId)
{
}
